﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;

namespace JQMdotNet
{
    static public class HelperUtilities
    {
#region FIX_ATTRIBUTES
        /// <summary>
        /// Returns an IDictionary with the '_' in the keys replaced with '-'
        /// </summary>
        /// <param name="htmlAttributes">The attributes to convert.</param>
        /// <returns></returns>
        static public IDictionary<string,object> Fix_Attributes(IDictionary<string,object> htmlAttributes)
        {
            RouteValueDictionary newAttr = new RouteValueDictionary();
            foreach(KeyValuePair<string, object> attr in htmlAttributes)
            {
                newAttr.Add(attr.Key.Replace("_", "-"),attr.Value);
            }

            return newAttr;
        }

        /// <summary>
        /// Returns an IDictionary with the '_' in the keys replaced with '-'
        /// </summary>
        /// <param name="htmlAttributes">The attributes to convert.</param>
        /// <returns></returns>
        static public IDictionary<string,object> Fix_Attributes(object htmlAttributes)
        {
            return Fix_Attributes(new RouteValueDictionary(htmlAttributes));
        }
#endregion

        
    }
}